package com.onlyphoto.onlymall.mvp.presenter

import android.content.Context
import com.onlyphoto.onlymall.base.BaseEntity
import com.onlyphoto.onlymall.base.BaseNetworkResponse
import com.onlyphoto.onlymall.base.BaseObserver

import com.onlyphoto.onlymall.mvp.contract.CSetPwd
import com.onlyphoto.onlymall.mvp.model.MSetPwdImpl
import com.onlyphoto.onlymall.base.BasePresenter


class PSetPwdImpl(mContext: Context, mView: CSetPwd.IVSetPwd) : BasePresenter<CSetPwd.IVSetPwd, MSetPwdImpl>(mContext, mView, MSetPwdImpl()), CSetPwd.IPSetPwd {
    override fun setPwd() {
        val bean = mView.getPwdBean()
        mModel.setPwd(bean, object :BaseObserver<BaseEntity>(mContext.get()){
            override fun onSuccess(data: BaseEntity?, msg: String?) {
                mView.setPwdSuccess()
            }

            override fun onCodeError(t: BaseNetworkResponse<BaseEntity>?) {
                mView.showMsg("网络错误，请稍后重试")
            }

            override fun onFailure(e: Throwable?) {
                mView.showMsg("网络错误，请稍后重试")
            }

            override fun onRequestStart() {
            }

            override fun onFinally() {
            }

        })
    }
}
